package org.scau.studentevaluation.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.scau.studentevaluation.config.global.log.WebLog;
import org.scau.studentevaluation.entity.query.AppealOtherActQuery;
import org.scau.studentevaluation.entity.vo.OtherActVO;
import org.scau.studentevaluation.service.IOtherActServicePart2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@Api("OtherAct控制器（part2）")
@WebLog("OtherAct控制器（part2）")
public class OtherActControllerPart2 {

    @Autowired
    private IOtherActServicePart2 otherActServicePart2;

    /**
     * 测试通过
     * @param studentId
     * @return
     */
    @ApiOperation("获取未审核列表")
    @GetMapping("/getUnCheckedOtherActivities/{studentId}")
    public List<OtherActVO> getUnCheckedOtherActivities(@PathVariable Long studentId){
        return otherActServicePart2.getUnCheckedOtherActivities(studentId);
    }


    /**
     * 测试通过
     * @param studentId
     * @return
     */
    @ApiOperation("请求未通过列表")
    @GetMapping("/getUnPassedOtherActivities/{studentId}")
    public List<OtherActVO> getUnPassedOtherActivities(@PathVariable Long studentId){
        return otherActServicePart2.getUnPassedOtherActivities(studentId);
    }

    /**
     * 测试通过
     * @param otherActivityIds
     * @return
     */
    @ApiOperation("删除活动")
    @DeleteMapping("/deleteActivities")
    public int deleteActivities(@RequestParam("otherActivityIds") List<Integer> otherActivityIds){
        return otherActServicePart2.deleteActivities(otherActivityIds);
    }


    /**
     * 测试通过
     * @param appealOtherActQuery  appealActivityId：申诉的活动id  appealRemark：申诉的上诉意见
     * @return
     */
    @ApiOperation("申诉活动")
    @PutMapping("/appealOtherActivity")
    public int appealOtherActivity(AppealOtherActQuery appealOtherActQuery){
        return otherActServicePart2.appealOtherActivity(appealOtherActQuery);
    }

    /**
     * 测试通过
     * @param otherActId
     * @return
     */
    @ApiOperation("判断活动是否check,返回1为check，0为uncheck")
    @GetMapping("/otherActIsCheck/{otherActId}")
    public Integer otherActIsCheck(@PathVariable Long otherActId){
        System.out.println(otherActId);
        return otherActServicePart2.OtherActIsCheck(otherActId);
    }

}
